#include"tcpServer.hpp"

#include<memory>

using namespace std;
using namespace ns_server;



static void usage(string proc)
{
    std::cout << "Usage:\n\t" << proc << " port\n"
              << std::endl;
}


std::string echo (const std::string& message)
{
    return message;
}


int main(int argc,char* argv[])
{
    if(argc != 2)
    {
        usage(argv[0]);
        exit(USAGE_ERR);
    }
    uint16_t port=atoi(argv[1]);
    unique_ptr<TcpServer> tcp_svr(new TcpServer(echo,port));

    tcp_svr->InitServer();
    // 将服务器守护进程化
    Daemon(); 
    tcp_svr->Start();
    return 0;
}